<!-- 病害审核页面 -->
<template>
	<view class="dis-review">
		<navBar title="病害审核"></navBar>
		<view class="test">
			<view class="text-site">
				{{formInfo.lineSiteSectionName}}
			</view>
			<view style="padding:0 30rpx">
				<searchCom class="search-input " v-model="searchText" style="margin-top: 120rpx;" @enter="determine"
					@change="searchChange"></searchCom>
			</view>
			<scroll-view scroll-y="true" style="height:calc(100vh - 400rpx);"> 
				<view class="all-content">
					<view class="t-content" v-for="(it,i) in dataList" :key="i">
						<view class="top-content">
							<view class="top-ring">{{ getContent(it) }}</view>
							<!-- :class="setLevelColor(it.rankClass)" -->
							<view class="top-lv" :class="{'red':it.rankClass === 'tall','orange':it.rankClass === 'central', 'blue':it.rankClass === 'bottom' || it.rankClass === 'nought'}" >{{it.diseaseGradeName || ''}}{{it.diseaseNo || ''}}</view>
							<view class="top-con">{{it.followup}}</view>
						</view>
						<view class="bottem-ev">{{it.diseaseStatus}}</view>
						<view class="but-t">
							<view class="bottem-time">提交时间：{{getDate2(it.createDate)}}({{it.createUserName}})</view>
							<view class="but-sh" @click="toExamine(it)">审核</view>
						</view>
					</view>
				</view>
				<view v-if="dataList.length === 0">
					<u-empty mode="data" text="数据为空" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import mixins from '@/utils/mixins'
	import navBar from "@/components/navBar/navBar.vue"
	import searchCom from "@/components/searchCom.vue"
	import {diseaseOrderGetList} from "@/api/engineeringMaintenance/engineeringMaintenance.js"
	
	export default {
		name: 'disReview',
		components: {
			navBar,
			searchCom

		},
		mixins:[mixins],
		data() {
			return {
				searchText: undefined,
				dataList:[],
				formInfo:{}
			}

		},
		onLoad(params) {
			if(params && params.data) {
				this.formInfo = JSON.parse(params.data)
				console.log(this.formInfo, 'mileagemileagemileage')
			}
		},
		onShow() {
			this.getDataList()
		},
		methods: {
			getDataList() {
				let resq = {
					currPage:1,
					pageSize:10000,
					params:{
						lineId:this.formInfo.lineId,
						lineSiteSectionId:this.formInfo.lineSiteSectionId,
						lineSiteSectionType:this.formInfo.lineSiteSectionType,
						pmId:this.formInfo.pmId,
						pmName:this.formInfo.pmName,
						type:'disease_review',
						keyword:this.searchText,
						projectId:uni.getStorageSync('isOwner')
					}
				}
				diseaseOrderGetList(resq).then(res => {
					console.log(res, '列表')
					if(res.success) {
						this.dataList = res.result.list
					}
				})
			},
			
			
			/**
			 * 输入框值变化的时候
			 * @param {String} val
			 */
			searchChange(val) {
				this.searchText = val
				if(this.searchText === '') {
					this.searchText = undefined
				}
				uni.$u.debounce(this.getDataList,500)
				
			},
			determine(ev) {
				console.log(ev)
				this.searchText = ev
				
			},
			toExamine(it) {
				// console.log(it,'=======')
				if (it.followup === '新增') {
					uni.navigateTo({
						url: `/subpackage-enginner/pages/engineeringMaintenance/disease_review/components/newly?id=${it.id}&type=${this.formInfo.mileage}`
					})
				} else {
					uni.navigateTo({
						url: `/subpackage-enginner/pages/engineeringMaintenance/disease_review/components/approval?id=${it.id}&type=${this.formInfo.mileage}`
					})
				}

				console.log('审核');
			},
			/**
			 * 高中低无  红橙蓝蓝
			 * **/
			setLevelColor(str) {
				if(str === 'tall') {
					return 'red'
				}else if(str === 'central') {
					return 'orange'
				}else if(str === 'bottom' || str === 'nought') {
					return 'blue'
				}else {
					return ''
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.dis-review {
		background-color:#f5f7f9 ;
		/* #ifdef MP-WEIXIN */
			padding-top: 200rpx;
		/* #endif */
		.test {
			background-color: #fff;
		}
		.text-site {
			height: 100rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #445469;
			line-height: 120rpx;
			margin-left: 40rpx;
		}

		.search-input {
			margin-top: 20rpx !important;
		}

		.all-content {
			// width: 686rpx;
			// height: 160rpx;
			margin: 0 30rpx;
			margin-top: 30rpx;

			.t-content {
				height: 200rpx;
				border-bottom: 3rpx dashed #c9c9d1;
				padding-top: 20rpx;
			}

			.top-content {
				display: flex;
				justify-content: flex-start;
				align-items: center;

				.top-ring {
					height: 44rpx;
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #445469;
					line-height: 38rpx;
					margin-right: 20rpx;
					// max-width: 380rpx;
					width: auto;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}

				.top-lv {
					font-size: 26rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 34rpx;
					background: linear-gradient(90deg, #5295FE 0%, #3FB8FF 100%);
					text-align: center;
					opacity: 1;
				}
				.top-lv.red {
					width: auto;
					padding: 6rpx 20rpx;
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					height: 34rpx;
					background: linear-gradient(90deg, #FF2B2B 0%, #FF603D 100%);
				}
				.top-lv.orange {
					width: auto;
					padding: 6rpx 20rpx;
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					height: 34rpx;
					background: linear-gradient(90deg, #FF882B 0%, #FF9F3D 100%);
				}
				.top-lv.blue {
					width: auto;
					padding: 6rpx 20rpx;
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					height: 34rpx;
					background: linear-gradient(90deg, #5295FE 0%, #3FB8FF 100%);
				}

				.top-con {
					// padding: 6rpx 20rpx;
					min-width: max-content;
					padding: 6rpx 18rpx;
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					height: 34rpx;
					font-size: 26rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 34rpx;
					background: #C6CDD8;
					text-align: center;
				}
			}

			.bottem-ev {
				margin-top: 20rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #6A819E;
				line-height: 32rpx;
				max-width: 500rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}

			.but-t {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.bottem-time {
					margin-top: 20rpx;
					height: 40rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #6A819E;
					line-height: 32rpx;
				}

				.but-sh {
					width: 90rpx;
					height: 52rpx;
					background: #2F80ED;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 52rpx;
					text-align: center;
				}
				
			}
			.ye {
				background: linear-gradient(90deg, #FF882B 0%, #FF9F3D 100%) !important;
			}
			
			.re {
				background: linear-gradient(90deg, #FF2B2B 0%, #FF603D 100%) !important;
			}
		}
	}
</style>
